<template>
  <div class="posiyion-rec">
      <!-- 推荐 -->
       <div class="project-recommendation">
            <!-- <p class="title_p" v-if="  this.$store.state.userinfo.type==1">推荐职位</p> -->
            <p class="title_p" >招聘大厅</p>
          <router-link to="/jobs">
              <span>更多</span>
              <svg class="icon icon-po" aria-hidden="true" >
                  <use xlink:href="#icon-shang-copy-copy-copy"></use>
              </svg>
          </router-link>
        </div>
        <!-- 职位信息列表 -->
        <div class="position-list" v-if="type==1">
            <!-- 每一条职位信息 -->
          <router-link class="position-item" :to="'/jobs/detail/'+item.id" v-for="(item,index) in Jobs" :key="index">
               <p class="p1">
               <span>{{item.name}}  {{item.nature}}</span>  <span>{{item.lowSalary}} K</span>
            </p>
            <p class="p2">
                <span class="p2-1">{{item.provinces}}</span><span class="fenge"></span>
                <span class="p2-2">{{item.degree}}</span><span class="fenge"></span>
                <span class="p2-3">{{item.experience}}</span><span class="fenge"></span>
                <span class="p2-4">{{item.addtime}}</span>
            </p>
            <p class="p3">
                 <span v-for="(tag,index2) in item.Arr_tags" :key="index2">{{tag}}</span>
            </p>
            <P class="p4"></P>
            <dl class="dl5">
                <dt><img :src="item.Publisher.headportrait"/></dt>
                <dd>
                    <p>{{item.Publisher.name}}</p>
                    <p>
                        <span>{{item.Publisher.workinglife}}人</span>
                        <span class="fenge02"></span>
                        <span>{{item.Publisher.industry}}</span>
                    </p>
                </dd>
            </dl>
          </router-link>
        </div>
        <div class="position-list" v-else>
            <!-- 每一条职位信息 -->
            <div   v-for="(item,index) in Jobs" :key="index" >
              <router-link class="position-item user-position" :to="'m/'+item.uid" active-class="active-p">
                      <div class="awatar-box">
                        <img :src="item.headportrait.indexOf('/Res')==-1?item.headportrait:'http://www.zhugongzhe.com'+item.headportrait"/>
                      </div>
                      <div class="position-right">
                        <p class="p-1">{{item.name}}<span>{{item.position}}</span></p>
                        <p class="p-2"><span>工作性质：{{item.positionType}}</span><span>期望城市：{{item.city}}</span><span>职位薪资：<i>{{item.monthlySalary}}</i></span></p>
                        <p  class="p-3">补充说明：<span>{{item.description}}</span></p>
                      </div>
              </router-link>
                      
          </div>
    </div>
  </div>
</template>
<script>
import { GetJobs,GetJobsWithBus} from "@/api/index";
export default {
  data() {
    return {
      Jobs: [],
      type:1,
    };
  },
  created() {
    this.type=this.$store.state.userinfo.type;
   this._GetJobs();
  },
  methods: {
    _GetJobs() {
      if(this.type==1){
      GetJobs().then(res => {
          if (res.StatusCode === 200) {
            this.Jobs = res.Data;
          }
        });
      }
      else{
          GetJobsWithBus().then(res => {
          if (res.StatusCode === 200) {
            this.Jobs = res.Data;
          }
        });
      }
    }
  }
};
</script>

<style lang="scss" scoped>
/* 推荐项目 */
.project-recommendation {

  height: 50px;
  overflow: hidden;
  border-top: 10px solid #f4f4f4;
  padding: 0 12px;
  border-bottom: 1px solid #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .title_p{
    font-weight: bold;
  }
  > :first-child {
    font-size: 16px;
    color: #282828;
  }
  > :last-child {
    font-size: 14px;
    color: #999999;
    > span {
      float: left;
      display: block;
    }
    > .icon {
      display: block;
      float: left;
      margin-top: 3px;
    }
  }
}
// liebiao
.position-list {
  overflow: hidden;

  .position-item {
    display: block;
    padding-left: 11px;
    padding-right: 11px;
    padding-bottom: 15.3px;
    border-bottom: 8.3px solid #f4f4f4;
    // 第一行
    .p1 {
      overflow: hidden;
      margin-bottom: 12px;
      margin-top: 16px;
      > :first-child {
        color: #282828;
        font-size: 16px;
        display: block;
        float: left;
      }
      .p1-bolder {
        color: #282828;
      }
      > :last-child {
        color: #fd4f00;
        font-size: 16px;
        display: block;
        float: right;
        margin-right: 12px;
      }
    }
    // 第二行
    .p2 {
      overflow: hidden;
      margin-bottom: 13px;
      display: flex;
      align-items: center;
       font-size: 14px;
      > span {
        color: #666666;
        font-size: 14px;
      }
      .p2-1 {
        margin-right: 9px;
      }
      .p2-2 {
        margin-right: 9px;
      }
      .p2-3 {
        margin-right: 9px;
      }
      .fenge {
        width: 1px;
        height: 12px;
        background: #666666;
        margin-right: 10px;
      }
      .p2-4 {
        float: right;
        margin-right: 12px;
      }
    }
    // 第三行
    .p3 {
      > span {
        font-size: 10px;
        color: #999999;
        padding: 5.3px 8.16px;
        border: 1px solid transparent;
        background: #f3f3f3;
        display: inline-block;
        margin-right: 11px;
      }
    }
    //第四行虚线
    .p4 {
      height: 0px;
      margin: 12px auto;
      border: 1px dashed #eeeeee;
    }
    // 第五个dl列表
    .dl5 {
      overflow: hidden;
      height: 55px;
      margin: 0;
      // 图片设置
      > dt {
        width: 40px;
        height: 40px;
        float: left;
        > img {
          width: 40px;
          height: 40px;
          display: block;
        }
      }
      > dd {
        float: left;
        margin-left: 14px;

        > p {
          color: #999999;
          font-size: 14px;
          margin: 0;
        }
        :first-child {
          color: #282828;
          font-size: 14px;
          margin-bottom: 3px;
        }
        :last-child {
          overflow: hidden;
          > span {
            margin-bottom: 0;
            font-size: 12px;
            color: #999999;
            display: block;
            float: left;
          }
          .fenge02 {
            width: 1px;
            height: 11px;
            border: 1px solid #999999;
            margin-top: 3.51px;
            margin-left: 11px;
            margin-right: 11px;
          }
        }
      }
    }
  }
  .user-position{
    display: flex;
    padding: 16px;
    .awatar-box{
      flex: 0 0 18%;
      width: 76.44px;
      height: 76.44;
      line-height: 76.44px;
      overflow: hidden;
      img{
        width: 100%;
        height: auto;
      }
    }
    .position-right{
      margin-left: 10px;
      flex: 0 0 75%;
      .p-1{
        font-size: 14px;
        color:#666;
        position: relative;
        span{
          color:#3887fe;
          padding-left: 15px;
          &::before{
            content: "";
            width: 2px;
            height: 10px;
            background: #3887fe;
            position: absolute;
            top:50%;
            margin-top:-5px;
            margin-left: -6px;
          }          
        }
      }
      .p-2{
        margin-top:10px;
        color:#666;
        font-size: 14px;
        overflow: hidden;
         display: flex;
         flex-wrap: wrap;
        span{
         
          flex: 0 0 50%;
          i{
            font-style: normal;
            color: red;
          }
        }
      }
      .p-3{
        font-size: 14px;
        color:#666;
        margin-top: 4px;
          span{
            color:#999;
          }
      }
    }
  }
}
.salary-add {
  color: #fd4f00 !important;
}
  .user-position{
    display: flex;
    padding: 16px;
    .awatar-box{
      flex: 0 0 18%;
      width: 76.44px;
      height: 76.44;
      line-height: 76.44px;
      overflow: hidden;
      img{
        width: 100%;
        height: auto;
      }
    }
    .position-right{
      margin-left: 5px;
      flex: 0 0 75%;
      .p-1{
        font-size: 14px;
        color:#666;
        position: relative;
        span{
          color:#3887fe;
          padding-left: 15px;
          &::before{
            content: "";
            width: 2px;
            height: 10px;
            background: #3887fe;
            position: absolute;
            top:50%;
            margin-top:-5px;
            margin-left: -6px;
          }          
        }
      }
      .p-2{
        margin-top:10px;
        color:#666;
        font-size: 14px;
        overflow: hidden;
         display: flex;
         flex-wrap: wrap;
        span{
         
          flex: 0 0 50%;
          i{
            font-style: normal;
            color: red;
          }
        }
      }
      .p-3{
        font-size: 14px;
        color:#666;
        margin-top: 4px;
          span{
            color:#999;
          }
      }
    }
  }

</style>
